package wsclient;

import java.util.List;

import nl.pimhazebroek.ws.ABCLibrary;
import nl.pimhazebroek.ws.ABCLibraryService;
import nl.pimhazebroek.ws.BookDAO;
import nl.pimhazebroek.ws.CustomerDAO;

public class Main {
	public static void main(String[] arg) throws Exception {
		ABCLibraryService service = new ABCLibraryService();
		ABCLibrary library = service.getABCLibraryPort();

		// show all customers
		System.out.println("All customers:");
		List<CustomerDAO> customers = library.allCustomers();
		for(CustomerDAO c : customers) {
			System.out.println("   -  " + c.getName());
		}
		System.out.println("Number of customers: " + customers.size() + "\n");
		
		// show all books
		System.out.println("All books:");
		List<BookDAO> books = library.allBooks1();
		for(BookDAO b : books) {
			String s = "   -  " + b.getTitle();
			if(b.getLendTo() != null) {
				s += " [lend to: " + b.getLendTo() + "]";
			}
			System.out.println(s);
		}
		System.out.println("Number of books: " + books.size());

		
	}
}
